<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ page import="com.sims.user.UserDAO"%>
 
<html>
<head>
	<title>学生信息管理系统</title>
	<style type="text/css">
		body {background-image: url(img/memory_in_nanjing.jpg);background-repeat: no-repeat;background-size: 100% 100%;font-size: 13px;}
		p {color: white;font-weight: bold;}
	</style>
</head>

<body>
	<% 
		    String userName=(String)session.getAttribute("username");
			int[] userrights = (int[])session.getAttribute("userrights");
			UserDAO ud = new UserDAO();
		    if (userName != null && ud.checkUserInfo(userName))
		    {
		    	response.sendRedirect("/sims/pages/default.jsp");
		    }
		    else
		    {
	%>
	<form action="Login.do" method="POST" style="position:absolute; top: 560px; left: 1230px;">
	<table>
		<tr>
			<td>
				<input required type="text" name="username" placeholder="用户名">
			</td>
		</tr>
		<tr>
			<td>
				<input required type="password" name="userpassword" maxlength="12" placeholder="密&nbsp;&nbsp;&nbsp;码">
			</td>
		</tr>
		<tr>
			<td>
				<button class="sign-button" type="submit" style="width: 70px;">登&nbsp;&nbsp;&nbsp;录</button>	
			</td>
		</tr>	
	</table>
	</form>
	<form style="position:absolute; top: 623px; left: 1309px;">
		<input name="regist" type="button" value="注&nbsp;&nbsp;&nbsp;册" onClick="location.href='/sims/pages/regist.jsp'" style="margin-left: 10px;width: 70px;">
	</form>
	<form style="position:absolute; top: 650px; left: 1235px;">
	<table>
	<tr>
			<p>
			<% 
			String errMsg = (String)request.getSession().getAttribute("Message");
			if (errMsg != null)
			{
				out.println(errMsg);
				request.getSession().removeAttribute("Message");
			}
			else
			{
				out.println("");
			}
			%>
			</p>
	</tr>
	</table>
	</form>
	<%
	}
	%>
</body>
</html>